summaryrefslogtreecommitdiff
path: root/test.stage
blob: ff159ffd244be19e18af12d14ba00ef596d40768 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

game.title = "Demo game";
game.author = "Mike Buland";
game.version = 1;
game.revision = 0;
game.start = <<start>>;

global
{
	command: "eat" object
	{
		display(object);
	}
	// You should always have a global exit, quit, escape, something for
	// dev-testing at least.
	command: "exit"
	{
		exit();
	}
}

function square( x )
{
	return( x*x );
}

function sillyDisplay( txt, extra )
{
	display("!~! " + txt + " !~!");
	if extra then
	{
		display("And then some extra!");
	}
	else
	{
		display("...no extra for you");
	}
}

function myGoto( txt )
{
	display( txt );
	goto( txt );
}

function getThing()
{
	display( situation.thing );
}

situation <<start>>
{
	command: "go" "home"
	{
		display("Home would be nice...");
	}

	command: "go" elsewhere
	{
		display("You don't know how to go " + elsewhere );
	}
	setup
	{
		stuff = {"things": 55, 112: "Bob"};
		display( stuff );
		display( 113 - 1 in stuff );
		exit();
	}

	enter
	{
		display('''This is the enter part of the start situation''');
	}
}

situation <<stuff>>
{
	command: "eat" object
	{
		display("You can't eat " + object );
	}
	
	command: "eat" object "now"
	{
		display("Alright, fine, eat " + object + " now..." );
	}

	setup
	{
		situation.thing = "Just a thing";
	}
	enter
	{
		getThing();
		display('''Entered stuff''' + player.name);
		count = 0;
		while count < 5 do
		{
			display('thing to count!');
			count += 1;
		}
	}
}